home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13694 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: news1.is.net!news
  2. From: Mark VanTassel <mvantassel@teambca.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: linking C & C++
  5. Date: Tue, 26 Mar 1996 18:00:49 -0500
  6. Organization: Barfield, Cauthen and Associates
  7. Message-ID: <31587721.4AAA@teambca.com>
  8. References: <4ibsla$pll@news.onramp.net>
  9. NNTP-Posting-Host: dynamic23.is.net
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (Win95; I)
  14.  
  15. Dean wrote:
  16. > I'm doing some work on a system that now requires me to do a longjmp from a C
  17. > program back into a C++ program.  The whole thing is linked into one big
  18. > executable.  I am having some trouble getting the thing linked, and I have
  19. > tried a number of different combinations.  What I have is a signal(), and
  20. > alarm(), and a longjmp() in the C file, and a setjmp() in the C++ file.  I have
  21. > tried defining the jmpbuffer in both files with it as an exter in the other,
  22. > but the linker always gives me a not-found condition for the jmpbuffer.  I know
  23. > that there is probably some little something that I'm not doing correctly, but
  24. > could use some ideas.  There are function calls in the C++ file to functions in
  25. > the C file, which then return, and everything there works just fine.  Any
  26. > suggestions?  Thanks.
  27.  
  28. I'm not sure this is a good idea - if you can get it to work at all, 
  29. you'll probably find that destructors don't get called for local vars as 
  30. it backs out of the C++ functions on its way back to the setjmp()... 
  31. this can lead to memory leaks, files left open, or all sorts of other 
  32. mayhem.
  33.  
  34. (if you're just going to print a message and die, that may not be a 
  35. terrible problem)
  36.